package cn.star.jots.user.controller;

import cn.star.jots.base.response.JsonResult;
import cn.star.jots.user.pojo.dto.UserSaveParam;
import cn.star.jots.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/v1/user")
@Api(tags = "用户注册")
@Slf4j
public class UserRegisterController {

    @Autowired
    UserService userService;

    @PostMapping("/register")
    @ApiOperation(value = "用户注册")
    public JsonResult register(UserSaveParam userSaveParam) {
        log.info("用户注册:userSaveParam={}", userSaveParam);
        userService.register(userSaveParam);
        return JsonResult.ok();
    }
}
